package emediashared.model;

import java.io.Serializable;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;

public class RemoteProgressMonitor extends UnicastRemoteObject implements Remote, Serializable, IRemoteProgressMonitor {

	private static final long serialVersionUID = 1L;

	private IProgressMonitor monitor = new NullProgressMonitor();
	
	public RemoteProgressMonitor() throws RemoteException {
	}

	public static IRemoteProgressMonitor getNonNullMonitor(IRemoteProgressMonitor remoteProgressMonitor) throws RemoteException {
		return remoteProgressMonitor != null ? remoteProgressMonitor : new RemoteProgressMonitor();
	}

	
	public void beginTask(String name, int totalWork) throws RemoteException {
		monitor.beginTask(name, totalWork);
	}

	
	public void worked(int work) throws RemoteException {
		monitor.worked(work);
	}

	
	public void done() throws RemoteException {
		monitor.done();
	}

}
